package net.srcz.jsjvm.core;

import java.io.PrintStream;
import java.util.Set;

import org.objectweb.asm.AnnotationVisitor;

public class JsAnnotationVisitor implements AnnotationVisitor {

	PrintStream ps;
	Set<String> classesRef;
	String name;
	String desc;
	
	public JsAnnotationVisitor(String name, String desc, Set<String> classesRef, PrintStream ps) {
		this.name = name;
		this.desc = desc;
		this.ps = ps;
		this.classesRef = classesRef;
		ps.printf("//anno visitor %s %s\n",name,desc);
	}

	@Override
	public void visit(String name, Object value) {
		ps.printf("// visit %s %s\n",name,value);
	}

	@Override
	public AnnotationVisitor visitAnnotation(String name, String desc) {
		ps.printf("// visitAnnotation %s %s\n",name,desc);
		return new JsAnnotationVisitor(name,desc,classesRef, ps);
	}

	@Override
	public AnnotationVisitor visitArray(String name) {
		ps.printf("// visitArray %s\n",name);
		return new JsAnnotationVisitor(name,null,classesRef, ps);
	}

	@Override
	public void visitEnd() {
		ps.printf("// visitEnd\n");
	}

	@Override
	public void visitEnum(String name, String desc, String value) {
		ps.printf("// visitEnum %s %s %s\n",name,desc,value);
	}

}
